#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    int maxDepth(string s) {
        int ret = 0;
        vector<char> vc;
        for (int i = 0; i < s.size(); i++)
        {
            if ('(' == s[i])
                vc.push_back(s[i]);
            else if (')' == s[i])
            {
                if (ret < vc.size())
                    ret = vc.size();
                vc.pop_back();
            }
        }
        return ret;
    }
};